/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package packageDBAccess;

import java.sql.*;
import packageException.ConnectionDBException;

/**
 *
 * @author pimas007
 */
public class DBConnection {
    
    private Connection co;
    
    public Connection getInstance() throws ConnectionDBException, ClassNotFoundException
    {
        try
        {
            if (co == null)
            {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                co = DriverManager.getConnection("jdbc:derby://localhost:1527/"+"librairie","akinox","bdjava");
                return co;
            }
            else
            {
                return co;
            }
            
        } 
        catch (SQLException ex)
        {
            throw new ConnectionDBException();
        } 
    }  
}
